#ifndef COMPONENTREGISTER_H
#define COMPONENTREGISTER_H

#include "Export.h"

#import "msado15.dll" rename_namespace("ADODB") rename("EOF", "ADOEOF")  

/* THREADSAFE */
class INFOBUS_API ComponentRegister
{
public:
  void registerComponent(const char* pzsGuid, const char* pszType, const char* pszListeningSubj);
  void unregisterComponent(const char* pszGuid);
  void activity(const char* pszGuid);
  bool isMasterActive(const char* pzsOwnGuid, const char* pszListeningSubj);
  bool isMaster(const char* pszGuid);
  bool existsMaster(const char* pszListeningSubj);
  void enableRedundancy(const char* pzsOwnGuid, const char* pszListeningSubj, bool bEnable);
  bool isRedundant(const char* pzsOwnGuid);
  void setMaster(const char* pzsGuid, bool bMaster);

  static ComponentRegister* getInstance();
protected:
  ComponentRegister();
  ~ComponentRegister();
private:
  void initConnection();
  ADODB::_ConnectionPtr cn;  

  static ComponentRegister* _singleton;
};


#endif